﻿/*
Animate 
Time Limit:1000MS  Memory Limit:32768K


Description:
Have you ever Googled the “Animate”?Tyr Googles the “Animate” 
one day, and find out 245 match records.
But he don’t know whether the number 245 is correct or not. 
Here comes the problem A: 
Give you a documentation,your task is to find out whether this documentation contains the word “Animate” or not. 

Input:
The input will consist of several case of input.
The first line is an integer N which give the case number.
The next part has N cases.Every case follows this format: 
Line 1: The beginning of the documentation: #Doc
Line 2 to m-1: The contest of documentation,this may be consists of several lines.
Every line contains less than 100 characters,and the total characters of one documentation is less than 1000.
Line m:The end of the documentation:#End 
Output:
For each input case,your program should print an anwser in a single line.
If the documentation contains “Animate”, please print “Yes”, else print “No”. 
In Google, we know the match is case insensitive,which means “animate” is also a match of “Animate”. 
In this problem we just take care of the alphabet characters, please ignore other characters. 
Sample Input:
2
#Doc
1Shanghai Jiaotong University=>Cappuccino
2Tsinghua University=>JHVHSecond Place
3Zhejiang University=>ZJU Focus
4Peking University=>PKU_MonkeyKing
5ZhongShan (Sun Yat-sen) University=>ZSU Pegasus
6Renmin University of China=>rruucc
7Zhejiang University=>Titan
8Zhejiang University of Technology=>Animate
#End
#Doc
AngryHair
#End
Sample Output:
Yes
No
*/
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[])
{
	int n;
	int position = 0;
	string strBuffer;
	strBuffer.reserve(1000);

	transform(strBuffer.begin(), strBuffer.end() ,strBuffer.begin(), tolower);
	cin >> n;
	while (n)
	{
		string s;
		cin >> s;
		if (s == "#Doc")
		{
			position = 1;
			continue;
		}
		else if (s == "#End")
		{
			position = 0;
			n--;

			transform(strBuffer.begin(), strBuffer.end(), strBuffer.begin(), tolower);
			if(string::npos == strBuffer.find("animate"))
				cout<<"No"<<endl;
			else
				cout<<"Yes"<<endl;
			strBuffer.clear();
			continue;
		}

		if (1 == position)
		{
			strBuffer+=s;
		}

	}
	cin.get();
	return 0;
}